package io.gitee.xyuesheng.day05;

import org.junit.Assert;
import org.junit.Test;

public class TestMyLinkedListE {
    @Test
    public void testRemove() {
        LinkedListE<String> list = new MyLinkedListE<>();
        list.add("abc");
        list.add("def");

        Assert.assertEquals(2, list.size());
        Assert.assertEquals("abc", list.get(0));

        list.remove(0);

        Assert.assertEquals(1, list.size());
        Assert.assertEquals("def", list.get(0));

        list.remove(0);

        Assert.assertEquals(0, list.size());
    }

    @Test
    public void testRemove2() {
        LinkedListE<String> list = new MyLinkedListE<>();
        list.add("abc");
        list.add("def");

        list.remove("abc");

        Assert.assertEquals(1, list.size());
        Assert.assertEquals("def", list.get(0));

        list.remove("def");
        Assert.assertEquals(0, list.size());
    }


}
